package com.czx.tools;


import com.czx.pojo.Query;

import java.io.Serializable;
import java.util.List;

/**
 * 分页显示数据的工具类
 */
public class Pages implements Serializable {
    /*
      分页步骤：
       1.确定分页需求
          1.1确定总数据量
          1.2确定页容量/页大小
          1.3确定总页数
          1.4确定当前页
       2.编写sql语句
       3.控制页码
     */
    //总记录数
    private int totalCount;
    //页大小
    private int pageSize=15;
    //总页数=总记录数/页大小(页显示的数量)
    private int totalPageCount;

    public List<Query> getAccessControlDeviceList() {
        return QueryList;
    }

    public void setAccessControlDeviceList(List<Query> accessControlDeviceList) {
        QueryList = QueryList;
    }

    //当前页
    private int currPageNo=1;



      private  List<Query> QueryList;

    public void setTotalCount(int totalCount) {
        if (totalCount != 0){
            //计算总页数
            this.totalPageCount=(totalCount % pageSize)==0 ? totalCount/pageSize: totalCount/pageSize+1;
        }
        this.totalCount = totalCount;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(int totalPageCount) {
        this.totalPageCount = totalPageCount;
    }

    public int getCurrPageNo() {
        return currPageNo;
    }

    public void setCurrPageNo(int currPageNo) {
        this.currPageNo = currPageNo;
    }

}
